﻿<html>
<head><title>.:: VNews - Tin tức tận tay ::.</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script type="text/javascript" src="jquery/jquery-1.8.1.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="UTF-8" />
<meta name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
	<script language="javascript">
		jQuery.ajax({
					xhrFields: {
					withCredentials: true
					},
					url:"http://buminta.pro/Vnews/service/login.php",
					success: function (data){
						console.log(data);
						var user_info = JSON.parse(data);
						console.log(user_info);
						if(user_info.result.status==true){
							alert('Đăng nhập có sẵn\nEmail:'+user_info.result.data.email);
							$(window.location).attr('href', 'news.htm');
						}
					}
				});
	</script>
</head>
<body>
<div id="logo"><img src="images/logo.png"></div>
<div id="login">
<input name="email" id="email" type="text/email" placeholder="Email" class="box"/>
</div>
<div id="password">
<input id="pass" name="password" type="password" placeholder="Password" class="box"/>
</div>
<div id="bt-login">
<input type="image" src="images/loginBtn.png" onClick="load_data()"/>
</div>
<script language="javascript">
	function load_data(){
		jQuery.ajax({
			type:"POST",
			data:{
				"email": $("#email").val(),
				"password": $("#pass").val()
				},
			xhrFields: {
				withCredentials: true
				},
			url:"http://buminta.pro/Vnews/service/login.php",
			success: function (data){
				console.log(data);
				var user_info = JSON.parse(data);
				console.log(user_info);
				if(user_info.result.status==true){
					alert('Đăng nhập thành công');
					 $(window.location).attr('href', 'news.htm');
				}
				else{
					alert('Tài khoản hoặc mật khẩu không đúng');
				}
			}
		});
	}
</script>

</body>
</html>
